//
// Created on 2025/7/21.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef AVCODECVIDEO_TIMELINE_H
#define AVCODECVIDEO_TIMELINE_H

#include <mutex>
#include <string>

class VideoAsset;
class AudioAsset;
class ImageAsset;

class Timeline {
public:
    explicit Timeline();
    ~Timeline() = default;

    void SetMainVideo(const std::string& path);
    void SetBgAudio(const std::string& path);
    std::string AddImage(const std::string& path);
    void UnsetBgAudio();
    void RemoveImage(const std::string& imageId);
    void PushImageTop(const std::string& imageId);
    std::shared_ptr<ImageAsset> GetImage(const std::string& imageId);
    
    const uint64_t GetVideoEndPos();
    const uint64_t GetVideoStartPos();
    const uint64_t GetDuration(); // 获取timeline时长，现在为主视频的截取后时长
    std::shared_ptr<VideoAsset> GetMainVideo();
    std::shared_ptr<AudioAsset> GetBgAudio();
    std::vector<std::shared_ptr<ImageAsset>> GetImages();
    
    
private:
    std::mutex m_mutexList;
    std::shared_ptr<VideoAsset> m_mainVideo{nullptr};
    std::shared_ptr<AudioAsset> m_bgAudio{nullptr};
    std::vector<std::shared_ptr<ImageAsset>> m_imagesList{};
};

#endif //AVCODECVIDEO_TIMELINE_H
